<template>
  <div class="cpro-public">
    <label :class="['el-form-item__label', showStat ? 'show' : '']">{{ title }}</label>
    <slot></slot>
    <div class="el-form-item__content">
      <slot name="content"></slot>
    </div>
  </div>
</template>

<script setup>
// 接受父组件传过来的数据
const datas = defineProps({
  title: {
    type: String,
    default: '默认标题'
  },
  // 是否显示为必填
  showStat: {
    type: Boolean,
    default: false
  }
})
</script>

<style lang="less" scoped>
.cpro-public {
  margin-bottom: 15px;
  .el-form-item__label {
    text-align: left;
    font-size: 16px;
    font-weight: 700;
    color: #151519;
    line-height: 40px;
  }
  .el-form-item__content {
    display: flex;
    justify-content: flex-start;
    line-height: 40px;
    font-size: 14px;
    margin: 16px 8px 0 8px;
  }
  .show.el-form-item__label::before {
    content: '*';
    color: #f56c6c;
    margin-right: 4px;
  }
}
</style>
